from matplotlib import pyplot as plt
import random

a=['什么','222','333','444','555','666']
b_1=[random.randint(25,50) for i in range(6)]
b_2=[random.randint(25,50) for i in range(6)]
b_3=[random.randint(25,50) for i in range(6)]

m=0.3
a1=list(range(len(a)))
a2=[i+m for i in a1]
a3=[i+m*2 for i in a1]

plt.bar(range(len(a)),b_1,width=m,color='yellow',label='001')                        #bar改成barh  绘制横着的图 横着之后宽度width就变成heigth
plt.bar(a2,b_2,width=m,color='red',label='002')
plt.bar(a3,b_3,width=m,color='green',label='003')

plt.legend(prop='STSong')

plt.xticks(fontproperties='STSong')

plt.grid(alpha=0.3)

plt.show()